package com.example.userdome.config;

import com.example.userdome.Interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截器
        registry.addInterceptor(new LoginInterceptor())
                //拦截所有
                .addPathPatterns("/**")
                //放行登录和注册接口
                .excludePathPatterns("/api/login","/api/register","/scores/{id}");
    }
}
